package com.kb.design.controller;


import com.kb.design.common.ApiResponse;
import com.kb.design.dto.ApplySpecialBonuses;
import com.kb.design.dto.BonusDistributionDTO;
import com.kb.design.dto.BonusQueryDTO;
import com.kb.design.dto.DesignProjectDTO;
import com.kb.design.service.BonusService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;;

/**
 * 奖金分配
 */
@RestController
@RequestMapping("bonus")
public class BonusDistributionController {

    @Resource
    private BonusService bonusService;
    /**
     * 获取项目奖项配置
     * @param
     * @return
     */
    @PostMapping("/getProjectBonusAllocation")
    public ApiResponse getProjectBonusAllocation(@RequestBody BonusQueryDTO bonusQueryDTO){
        return ApiResponse.success(bonusService.searchData(bonusQueryDTO));
    }

    /**
     * 客服提交奖金配置
     *@Validated 参数校验 分组
     * @param
     * @return
     */
    @PostMapping("/submitBonusConfiguration")
    public ApiResponse submitBonusConfiguration(@RequestBody BonusDistributionDTO bonusDistributionDTO) {
        return ApiResponse.success(bonusService.submitBonusConfiguration(bonusDistributionDTO));
    }
    /**
     * 查询 客服或 负责人提交的奖励配置
     *@Validated 参数校验 分组
     * @param
     * @return
     */
    @PostMapping("/personalBonusesInfo")
    public ApiResponse personalBonusesInfo(@RequestBody BonusQueryDTO bonusQueryDTO) {
        return ApiResponse.success(bonusService.personalBonusesInfo(bonusQueryDTO));
    }

    /**
     * 提交奖金分配
     * @param
     * @return
     */
    @PostMapping("/submitBonusAllocation")
    public ApiResponse submitBonusAllocation(@RequestBody BonusDistributionDTO bonusDistributionDTO){
        return ApiResponse.success(bonusService.submitBonusAllocation(bonusDistributionDTO));
    }
    /**
     * 奖金确认
     * @param
     * @return
     */
    @PostMapping("/bonusConfirmation")
    public ApiResponse bonusConfirmation(@RequestBody BonusDistributionDTO bonusDistributionDTO){
        return ApiResponse.success(bonusService.bonusConfirmation(bonusDistributionDTO));
    }
    /**
     * 无需分配奖金
     * @param
     * @return
     */
    @PostMapping("/noBonus")
    public ApiResponse noBonus(@RequestBody DesignProjectDTO designProjectDTO){
        return ApiResponse.success(bonusService.noBonus(designProjectDTO));
    }
    /**
     * 重新分配奖金
     * @param
     * @return
     */
    @PostMapping("/againBonus")
    public ApiResponse againBonus(@RequestBody DesignProjectDTO designProjectDTO){
        return ApiResponse.success(bonusService.againBonus(designProjectDTO));
    }
    /**
     * 特殊奖金申请
     * @param
     * @return
     */
    @PostMapping("/applySpecialBonuses")
    public ApiResponse applySpecialBonuses(@RequestBody ApplySpecialBonuses applySpecialBonuses){
        return ApiResponse.success(bonusService.applySpecialBonuses(applySpecialBonuses));
    }
}
